/**
 * author: zhangwei
 * 角色新增、编辑
 */
var pageType = "add";
var main = {

    init: function() {
        this.initTable();
    },
    initTable: function() {

        layui.use(['form','laydate'], function() {
            var form = layui.form;

            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#test1' //指定元素
            });

            //监听提交
            form.on('submit(formSubmit)', function(data) {
                var url = "/student/saveStudentBaseInfo";
                var json = $("#roleForm").serialize();
                $.ajax({
                    type:"post",
                    data:json,
                    async:false,
                    url:url,
                    success:function(result) {
                        if (result.code == property.successCode) {
                            successMsg("提交成功");
                        } else{
                            errorMsg(result.msg);
                        }
                    },
                    error:function(result) {
                        errorMsg("系统异常");
                    }
                });
                return false;
            });

            //监听重置
            $("#cancel").click(function () {
                parent.$(".myRefresh").click();
                layer.close(index);
                return false;
            });

        });
    }
}
main.init();





